<?php
  /* Group.php
  * Groups are structures indended for management of employees
  * Groups contain seperate collections of managers and employees
  * Managers are able to modify the hours and resolve requests of employees belonging to the same group
  * Managers and employees can each belong to multiple groups
  */
class Group extends AppModel
{
	var $name = 'Group';
	//validation rules
        var $validate = array(
	'id'=> array(
		'rule'=>'numeric',
		'required'=>true
	)
    );

	public $hasAndBelongsToMany = array(
			'Employees' => array(
				'className'              => 'Employee',
				'joinTable'              => 'group_members',
				'foreignKey'             => 'group_id',
				'associationForeignKey'  => 'emp_id',
				),
			'Managers' => array(
				'className'              => 'Manager',
				'joinTable'              => 'group_managers',
				'foreignKey'             => 'group_id',
				'associationForeignKey'  => 'mgr_id',
				),
			);
}
?>
